import React from 'react'
import {Route, Redirect} from 'react-router-dom'
// import {isAuthenticated} from "../../utils/session";

const RequireAuthRoute = ({component: Component,isAuthenticated, ...rest}) => (




    <Route
        {...rest}
        render={(props) => {
            console.log(isAuthenticated);
            return isAuthenticated ? <Component {...props}/>
                : <Redirect to={{
                    pathname: '/login',
                    state: {from: props.location}
                }}/>

        }}
    />
);
export default RequireAuthRoute;
